package sim;

/**
 * The simulation to solve problem 1
 * 
 * @author David Stezenbach
 * @author Michael Hoefling
 */
public class DES01 {
	public SimulationParametersDES01 params;
	public SimulationStatisticsDES01 stats;
	public SimulationStateDES01 state;
	public Simulator simulator;
	public DiscreteTimeCounter discreteCounter;
	public ContiniousTimeCounter continousCounter;
	
	/**
	 * @param args interArrivalTime serviceTime simulationDuration
	 */
	public static void main(String[] args) {
		/*
		 * create simulation object
		 */
		DES01 sim = new DES01(args);
		/*
		 * run simulation
		 */
		sim.start();
		/*
		 * print out report
		 */
		sim.report();
	}	

	public DES01(String[] args) {
		//stichproben = new Stichproben();
		discreteCounter = new DiscreteTimeCounter();
		continousCounter = new ContiniousTimeCounter();
		
		simulator = new Simulator(this);
		simulator.setSimTimeInRealTime(1000);
		
		params = new SimulationParametersDES01(this, args);
		stats = new SimulationStatisticsDES01();
		state = new SimulationStateDES01(stats);
		
		simulator.pushNewEvent(new SimulationBeginEvent(this, 0));
		simulator.pushNewEvent(new SimulationTerminationEvent(this, params.simulationDuration));		
	}

	public void report() {
		params.report();
		stats.report();
		discreteCounter.report();
	}
	
	public void start() {
		simulator.run();
	}
}
